const path = require('path');


const HtmlPlugin = require('html-webpack-plugin')
//这时我们得到了一个构造函数，我们需要创建一个该插件的实例对象
 
const htmlPlugin = new HtmlPlugin({
    template:'./index.html',
    filename:'./index.html'
})


module.exports = {
  entry: './src/devel.ts',
  devtool: 'inline-source-map',
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: 'ts-loader',
        exclude: /node_modules/
      }
    ]
  },
  resolve: {
    extensions: [ '.tsx', '.ts', '.js' ],
    fallback: {
      "util": false
    }
  },
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist'),
    library: ['devel']
  },
  mode: 'development',
  watch: true,
  plugins:[htmlPlugin],
  devServer: {
    open:true,
    hot: true,
    static: {
      directory: path.join(__dirname, '.'),
    },
    //compress: true,
    port: 9000,
  },
};
